/*
 * work.hpp
 *
 *  Created on: Jul 26, 2010
 *      Author: sdaniele
 */

#ifndef WORK_HPP_
#define WORK_HPP_

#include <float.h>

namespace syscpar{namespace test{
#define exp2(k)\
	(1UL<<(k))


/*
 * Work is an action, performs 2^log_ops math operations
 *
 */
template <int log_ops>
struct work
{
	BOOST_MPL_ASSERT_RELATION(log_ops,>=,0);

	void operator()() const
	{
		double dummy = DBL_MAX;
		for(unsigned long i=0;i<exp2(log_ops);i++)
			dummy = dummy/1.01;

		report();
	}


	void report() const
	{
		if(is_verbose())
			std::cout << "work reporting " << exp2(log_ops) << " flops performed ok\n";
		else
			std::cout << "work reporting\n";
	}
};

}}

#endif /* WORK_HPP_ */
